//
//  ByViewLineArow.m
//  chequanbao_ios
//
//  Created by mc on 2017/10/10.
//  Copyright © 2017年 com.itboye. All rights reserved.
//

#import "ByViewLineArow.h"

@implementation ByViewLineArow
{
    // 三个点
    CGPoint     _point2;
    CGPoint     _point3;
    CGPoint     _point4;
}
- (instancetype)initWithFrame:(CGRect)frame Point2:(CGPoint) point2 Point3:(CGPoint) point3 Point4:(CGPoint) point4{
    if (self = [super initWithFrame:frame]) {
        _point2 = point2;
        _point3 = point3;
        _point4 = point4;
    }
    return self;
}
- (instancetype)initWithPoint2:(CGPoint) point2 Point3:(CGPoint) point3 Point4:(CGPoint) point4{
    if (self = [super init]) {
        _point2 = point2;
        _point3 = point3;
        _point4 = point4;
    }
    return self;
}

- (void)drawRect:(CGRect)rect{
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetLineCap(context, kCGLineCapRound);
    CGContextSetLineWidth(context, 2);                  //线宽
    CGContextSetAllowsAntialiasing(context, true);
    CGContextSetRGBStrokeColor(context, 1, 1, 1, 1.0);  //线的颜色
    CGContextBeginPath(context);
    CGContextMoveToPoint(context, 10, 10);              // 起点坐标
    
    CGContextAddLineToPoint(context, _point2.x, _point2.y);
    CGContextAddLineToPoint(context, _point3.x, _point3.y);
    CGContextAddLineToPoint(context, _point4.x, _point4.y);
    CGContextAddLineToPoint(context, self.width - 10, 10);
    CGContextStrokePath(context);
    
    
//    CGFloat margin = (SCREEN_WIDTH - 50 * 4) / 5;
//    CGFloat x = margin * 2 + 50 + 15;
//    CGContextAddLineToPoint(context, x, 10);
//    x = x + 10;
//    CGContextAddLineToPoint(context, x, 0);
//    x = x + 10;
//    CGContextAddLineToPoint(context, x, 10);
//    x = self.width;
//    CGContextAddLineToPoint(context, x, 10);
//    CGContextStrokePath(context);

    
}

@end
